package ace.module.oauth2.server.core.impl.authentication.password;

import java.util.Optional;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

/**
 * @author caspar
 * @date 2023/2/8 13:43 密码模式 获取用户接口
 */
public interface Oauth2PasswordAuthenticationUserDetailsService {

  /**
   * @param token The pre-authenticated authentication token
   * @return UserDetails for the given authentication token, never null.
   * @throws UsernameNotFoundException if no user details can be found for the given
   *                                   authentication token
   */
  Optional<UserDetails> loadUserDetails(Oauth2PasswordAuthenticationToken token)
      throws UsernameNotFoundException;
}
